package iodemo;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class FileIO
{
    public static void main (String[] args) throws FileNotFoundException
    {
        try(FileInputStream fileInputStream = new FileInputStream("D:/iDonotKnow.txt"))
        {
            int temp = 0;
            StringBuilder stringBuilder = new StringBuilder();
            
            while((temp = fileInputStream.read()) != -1)
            {
                stringBuilder.append((char)temp);
            }
    
            System.out.println(stringBuilder);
        }
        catch(IOException e)
        {
            e.printStackTrace();
        }
        
//        try(FileOutputStream fileOutputStream = new FileOutputStream("D:/iDonotKnow.txt", true))
//        {
//            String string = "\nNo, you know!";
//
//            fileOutputStream.write(string.getBytes());
//
//            fileOutputStream.flush();
//        }
//        catch(IOException e)
//        {
//            e.printStackTrace();
//        }
    }
}
